# Contributor: TBK <alpine@jjtc.eu>
# Maintainer: TBK <alpine@jjtc.eu>
pkgname=rcon
pkgver=0.5
pkgrel=0
pkgdesc="Source RCON client for command line."
url="https://github.com/n0la/rcon"
arch="all !s390x !mips !mips64"
license="BSD-2-Clause"
makedepends="bash-completion cmake glib-dev libbsd-dev"
checkdepends="check-dev"
subpackages="$pkgname-doc $pkgname-bash-completion:bashcomp:noarch"
source="$pkgname-$pkgver.tar.gz::https://github.com/n0la/rcon/archive/$pkgver.tar.gz
	no-werror.patch
	"

build() {
	cmake -B build . \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DINSTALL_BASH_COMPLETION=ON
	make -C build
}

check() {
	make -C build test
}

package() {
	make -C build DESTDIR="$pkgdir" install
}

bashcomp() {
	depends=""
	pkgdesc="Bash completions for $pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel bash-completion"

	amove usr/share/bash-completion
}

sha512sums="bee716cdec855c8505a701d4bed000cba981684477c9a4d73023cf13a32287dcb9a6643a0bd22823a82e7be9afcdf78c69f8b432507b2ef6408a58837805f812  rcon-0.5.tar.gz
a421b0cba054df504de63814ed711004e5806d7670b34179d9bd5751bb47e1e1dc3f47162d26e6276d0972c493de0bd48565f2f46d8d9b62e8c8bfaac6bf6054  no-werror.patch"
